begintownscript; // Need scenario ender, finishing touches: crime level

variables;
short choice;

body;

beginstate INIT_STATE;
	if((get_flag(1,2) == 1) && (get_flag(3,10) == 0)){
		flip_terrain(24,33);
		flip_terrain(24,34);
		}
	if(get_flag(3,10) == 1){
		activate_hidden_group(1);
		}
break;

beginstate START_STATE;
	if(get_flag(1,0) <= 0){
		message_dialog("It was a fairly long travel to Nowhere Special, and The Boss was already asleep by the time you reached Fort Town.  You were more than grateful for the opportunity to sleep in a warm bed though.","You arise feeling refreshed, ready to take on whatever The Boss has in store, whether it be goblins, demons, or even dragons!");
		message_dialog("The idea of new work and adventures has you almost salivating.  It's time to go meet The Boss and get started.  The closer you are to starting, the closer you are to finishing and to getting the paycheck.","");
		message_dialog("The Boss' office is to the west.  If you need equipment, check the nearby chests.","");
		set_flag(1,0,1);
		}

	if(get_crime_level() >= 1){
		message_dialog("This was the wrong fort of heavily armed guards to piss off.  After committing your crime, you are immediately surrounded and killed.  Bummer.","");
		kill_char(1000,2,0);
		}

	if(get_ran(1,0,19) < 6){
		text_bubble_on_char(6,"*URP*");
		}
	if(get_ran(1,0,19) < 6){
		text_bubble_on_char(6,"*MUNCH*");
		}
	if(get_ran(1,0,19) < 6){
		text_bubble_on_char(6,"*GOBBLE*");
		}
	if(get_ran(1,0,19) < 6){
		text_bubble_on_char(6,"*SLURP*");
		}
break;

beginstate EXIT_STATE;
break;

beginstate 10;
	if(get_flag(1,1) <= 0){
		message_dialog("The Boss sits at his table, accompanied by his meal and four guards.  The man is fat beyond belief; it's a wonder that the chair supports his weight.","");
		set_flag(1,1,1);
		}
break;

beginstate 11;
	if(get_flag(1,10) == 1){
		reset_dialog();
		add_dialog_str(0,"As you leave the office feeling ready to take on the world, you notice a smug potted plant sitting in the corner of the hall.",0);
		add_dialog_str(1,"You could tip it over if you wanted, just to rid the plant of its smug attitude.",0);
		add_dialog_str(2,"Tip the plant over?",0);
		add_dialog_choice(0,"It's just a plant...");
		add_dialog_choice(1,"I don't like the way it looked at me!");
		choice = run_dialog(1);

		if(choice == 2){
			message_dialog("You kick the crap out of the plant and reduce it to a humble pile of dirt and rubble.","");
			set_terrain(28,21,137);
			inc_flag(10,10,1);
			set_flag(1,10,2);
			}
			else{
				message_dialog("You decide to leave the innocent plant alone.","");
				set_flag(1,10,2);
				}
		}
break;
beginstate 12;
	if(get_flag(1,2) <= 0){
		message_dialog("Oh no, the gate is closed!","Fortunately, this can easily be remedied by turning the Gate Wheel, which is west of The Boss' office.");
		block_entry(1);
		}
break;
beginstate 13;
	if(get_flag(1,2) <= 0){
		reset_dialog();
		add_dialog_str(0,"This wheel controls the gates that are currently keeping you from completing your mission.  One of the guards watches you suspiciously.",0);
		add_dialog_str(1,"_Don't even think about touching that wheel.  Opening and closing the gates is my job!_",0);
		add_dialog_str(2,"Open the gate yourself?",0);
		add_dialog_choice(0,"No, that guard looks scary...");
		add_dialog_choice(1,"I'll touch what I want, when I want!");
		choice = run_dialog(1);

		if(choice == 2){
			message_dialog("You turn the wheel yourself, and the gates miraculously open!  The guard looks disappointed.","_Aww, that was my job._");
			inc_flag(10,10,1);
			}
			else{
				message_dialog("You decide that it'd be better to leave the wheel turning to the guard.  He shoves you aside and turns the wheel.","_Happy?  Now leave me be._");
				}
		play_sound(99);
		flip_terrain(24,33);
		flip_terrain(24,34);
		set_flag(1,2,1);
		}
break;
beginstate 20; //prevent from not seeing the boss
	if(get_flag(1,10) <= 0){
		message_dialog("You can't leave until you get your mission!","");
		block_entry(1);
		}
break;